package com.woniuxy.redis01.configuration;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 作者
 * @create 2025-06-25 14:11
 */
@Configuration
public class RabbitmqConfiguration {

    @Bean
    public MessageConverter messageConverter(){
        return new Jackson2JsonMessageConverter();
    }

//    <bean id="" class="" />
    @Bean
    public Queue queueemail(){
        return new Queue("queueemail");
    }

    @Bean
    public TopicExchange exchangetopic(){
        return new TopicExchange("exchangetopic");
    }

    @Bean
    public Binding bindingemail( Queue queueemail, TopicExchange exchangetopic){
        return BindingBuilder.bind(queueemail).to(exchangetopic).with("#.email.#");
    }
}
